package kz.pdt12.hw.data;

/**
 * Created with IntelliJ IDEA.
 * User: raimbek
 * Date: 07.03.13
 * Time: 0:40
 */
public class GroupData implements Comparable<GroupData> {
    public String id;

    public String name;
    public String header;
    public String footer;
    public GroupData() {
    }

    public GroupData(String name, String header, String footer) {
        this.name = name;
        this.header = header;
        this.footer = footer;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getHeader() {
        return header;
    }

    public void setHeader(String header) {
        this.header = header;
    }

    public String getFooter() {
        return footer;
    }

    public void setFooter(String footer) {
        this.footer = footer;
    }

    @Override
    public String toString() {
        return "GroupData [id=" + id + "] [name=" + name + "]";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null) {
            return false;
        }
        if (getClass() != o.getClass()) {
            return false;
        }

        GroupData other = (GroupData) o;
        if (name == null) {
            if (other.name != null) {
                return false;
            }
        } else if (!name.equals(other.getName())) {
            return false;
        }

        return true;
    }

    @Override
    public int compareTo(GroupData groupData) {
        return this.name.toLowerCase().compareTo(groupData.getName().toLowerCase());
    }

    public GroupData withId(String id) {
        this.id = id;
        return this;
    }

    public GroupData withName(String name) {
        this.name = name;
        return this;
    }

    public GroupData withFooter(String footer) {
        this.footer = footer;
        return this;
    }

    public GroupData withHeader(String header) {
        this.header = header;
        return this;
    }
}
